<?php
/* @var $this UsuarioController */
/* @var $model Usuario */
/* @var $form CActiveForm */
?>

<script type="text/javascript">
$(document).ready(function(){
	$("#Usuario_Descuentos").keypress(function(event){
		var keynum = window.event ? window.event.keyCode : e.which;
    	if ((keynum == 8) || (keynum == 0))
    		return true;
   		return /\d/.test(String.fromCharCode(keynum));
   		});
});
</script>


<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'usuario-form',
	'enableAjaxValidation'=>false,
	'enableClientValidation'=>false,
	'clientOptions'=>array(
		'validateOnSubmit'=>true)
)); ?>


	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'Nick'); ?>
		<?php echo $form->textField($model,'Nick',array('size'=>10,'maxlength'=>10)); ?>
		<?php echo $form->error($model,'Nick'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'NOMBRE'); ?>
		<?php echo $form->textField($model,'NOMBRE',array('size'=>20,'maxlength'=>20)); ?>
		<?php echo $form->error($model,'NOMBRE'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'APELLIDO'); ?>
		<?php echo $form->textField($model,'APELLIDO',array('size'=>30,'maxlength'=>30)); ?>
		<?php echo $form->error($model,'APELLIDO'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'Contraseña'); ?>
		<?php echo $form->passwordField($model,'Contraseña',array('value'=>'','size'=>40,'maxlength'=>40)); ?><br>
		<?php echo $form->error($model,'Contraseña'); ?>
	</div>




		<?php
		if(Yii::app()->user->perfil == '1') 
		{?>
			<div class="row">
				<?php echo $form->labelEx($model,'ESTADO'); ?>
				<?php echo $form->dropDownList($model, 'ESTADO',
    				array('1' => 'Local', '2' => 'Web','3' => 'Inactivo', '4' => 'Inactivo Web'),
    				array('empty' => 'Seleccione un estado')); ?>
				<?php echo $form->error($model,'ESTADO'); ?>
			</div>

			<div class="row">
			<?php echo $form->labelEx($model,'Descuento');?>
			<?php echo $form->textField($model,'Descuentos',array('maxlength'=>2));?> 
			<?php echo $form->error($model,'Descuentos');?>
			</div>
		<?php } ?>



	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Guardar' : 'Guardar'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->